package com.yue.ssa.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhengyl
 * @description
 * @date 2020-07-31 17:16
 */
@RestController
public class TestController {
    @PreAuthorize("hasAuthority('one::write')")
    @GetMapping("test1")
    public String test1() {
        return "test1";
    }

    @PreAuthorize("hasAuthority('two::write')")
    @GetMapping("test2")
    public String test2() {
        return "test2";
    }

    @PreAuthorize("hasAuthority('three::write')")
    @GetMapping("test3")
    public String test3() {
        return "test3";
    }

    @PreAuthorize("hasAuthority('one::read')")
    @GetMapping("test4")
    public String test4() {
        return "test4";
    }

    @PreAuthorize("hasRole('ROLE_admin')")
    @GetMapping("test5")
    public String test5() {
        return "test5";
    }
}
